<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$Think.config.site.title} - 修改主题信息</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight"> 
      <div class="row">
      <form method="post" class="form-horizontal" action="" id="Myform" enctype="multipart/form-data" >
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <div class="form-group">
                         <input type="hidden" name="id" value="{$v.id}">
                            <label class="col-sm-2 control-label">主题名称</label>
                            <div class="col-sm-10">
                                <input id="name" name="name" class="form-control" required="required" placeholder="请输入主题名称" value="{$v.name}" type="text">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >主题ID</label>
                            <div class="col-sm-10">
                                <input id="themeid" name="themeid" required="required" class="form-control" placeholder="请输入主题ID" type="text" value="{$v.themeid}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >主题颜色</label>
                            <div class="col-sm-10">
                                <input id="color" name="color" required="required" class="form-control" placeholder="请输入主题颜色" type="text" value="{$v.color}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >首页效果图</label>
                            <div class="col-sm-10">
                                <input id="index_img" name="index_img" required="required" class="form-control" placeholder="请上传首页图片" type="file" value="$v.index_img" >
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >用户中心效果图</label>
                            <div class="col-sm-10">
                                <input id="user_img" name="user_img" required="required" class="form-control" value="{$v.user_img}" placeholder="请上传用户中心效果图" type="file" >
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >充值中心效果图</label>
                            <div class="col-sm-10">
                                <input id="recharge_img" name="recharge_img" required="required" class="form-control" value="{$v.recharge_img}" placeholder="请上传充值中心效果图" type="file" >
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row"  style="margin-top: 23px;">
            <div class="center-block col-sm-2">
                <button type="button" class="btn btn-primary btn-block" id="submit">提　交 </button>
            </div>      
        </div>
        </form>
    </div>
    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/content.min.js?v=1.0.0"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script type="text/javascript">
    //更新信息
    $('#submit').click(function(){
            var name = $('#name').val();
            var themeid = $('#themeid').val();
            var color = $('#color').val();
            if(name==''){
                $('#name').placeholder('请输入主题名称');
                $('#name').focus();
                return false;
            }
            if(themeid==''){
                $('#themeid').placeholder('请输入主题ID');
                $('#themeid').focus();
                return false;
            }
            if(color==''){
                $('#color').placeholder('请输入主题颜色');
                $('#color').focus();
                return false;
            }
            var formData = new FormData($( "#Myform" )[0]);
            $.ajax({
                type : 'POST',
                url  : '<?php echo \think\Request::instance()->root(); ?>/ausadmin/System/edittheme',
                dataType : 'json',
                data: formData, 
                async: false, 
                cache: false, 
                contentType: false, 
                processData: false, 
                success: function (result) { 
                    if(0 === result.code) {
                        layer.msg(result.msg, {icon: 1});
                        parent.location.reload();
                    }else{
                        layer.msg(result.msg, {icon: 5});
                    } 
                },
                error: function () {
                  layer.msg('服务器错误！请稍后重试', {icon: 2}); 
                }
            })
        });
  </script>

</body>

</html>